package com.sgsg.designmodetest;

import java.util.ArrayList;

public abstract class Subject {

    private ArrayList<Observer> observers = new ArrayList<>();

    public void addObserver(Observer observer){
        observers.add(observer);
    }

    public void detachObserver(Observer observer){
        observers.remove(observer);
    }

    public void Notify(){
        for (Observer obs:observers) {
            obs.update();
        }
    }

}
